<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <p v-lower-case="text"></p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        //全局指令
        Vue.directive('upper-case', (el, binding) => {
            el.textContent = binding.value.toUpperCase();
        });


        const vm = new Vue({
            data: {
                text: "hello would"
            },
            //局部指令
            directives: {
                /*
                     el 绑定指令属性的DOM元素
                     binding 指令信息
                       expression 表达式
                       value 表达式的值
                       name 指令名称
                       rawName 指令完整名称
                */
                "lower-case"(el, binding) {
                    el.textContent = binding.value.toLowerCase();
                }
            }
        });
        vm.$mount("#app");   
    </script>
</body>

</html>